home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_spooktrapziptalk.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  282 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_SpookTrapZipTalk.cog
  4. #
  5. # Indy is nervous when things get weird
  6. #
  7. # [HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. # NOTE: This is a random verbal reaction to weirdness and darkness.
  13. # Glue it into your level and reach it from a calling cog like this:
  14. #
  15. # 1. Create a valid reference to this cog in your calling cog;
  16. #
  17. # 2. Use the following verb:
  18. #    SendMessageEx(thiscogREF, i_userMessage, f_parm0, f_parm1, f_parm2, f_parm3);
  19. #    (see each section below for details...)
  20. #
  21. # 3. Use global15 as a semaphore and return value where neeeded;
  22. #
  23. # The resulting chatter is pre-approved by HB...
  24. #
  25. # PRODUCT SUPPORT:  cogsrus x8371
  26.  
  27. # ==============================================================================
  28.  
  29. symbols
  30.  
  31. # ................................. MESSAGES ...................................
  32.  
  33.     message user0    # spooky lines
  34.     message user1    # trap lines
  35.     message user2    # need zippo lines
  36.  
  37. # ................................. SAY LINES ..................................
  38.  
  39.     # spooky lines...
  40.     sound    in_sayline=Inxj044.wav                local # Making me nervous-->in_sayline[0]
  41.     sound    in_creepy=Inxj048.wav                local # Why creepy feeling?
  42.     sound    in_jumpy=Inxj042.wav                local # Something wrong here.
  43.     sound    in_nofear=Inxj046.wav                local # Nothing to fear...scares me
  44.  
  45.     # trap lines...
  46.     sound    in_wronghere=Inxj042.wav            local # Something wrong-->in_sayline[4]
  47.     sound    in_notfeelright=Inxj043.wav            local # This doesn't feel right.
  48.     sound    in_danger=Inxj045.wav                local # Danger!    
  49.     sound    in_sensetrap=inxj041a.wav           local # Sense a trap. (JC - filename changed)
  50.  
  51.     # zippo lines...
  52.     sound    in_darkhere=Inxj038.wav                local # Dark in here-->in_sayline[8]
  53.     sound    in_cantsee=Inxj039.wav                local # Can't see a thing.
  54.     sound    in_needlight=Inxj040.wav            local # Need some light here.
  55.  
  56. # ............................... VARIABLES ....................................
  57.  
  58.     flex    talkerREF                            local
  59.     flex    forceTalk                            local
  60.     flex    forceLine                            local
  61.     
  62.     int        lineindex                            local # indexes sound array
  63.     int        spookoffset=0                        local # define
  64.     int        trapoffset=4                        local # define
  65.     int        zipoffset=8                            local # define
  66.  
  67.     int        alreadyworking=0                    local
  68.  
  69.     int        s_newline=50                        local # init outside actual range
  70.     int        s_oldline=50                        local
  71.     int        t_newline=50                        local
  72.     int        t_oldline=50                        local
  73.     int        z_newline=50                        local
  74.     int        z_oldline=50                        local
  75.  
  76.     int        dummy
  77.     
  78. # subroutines
  79.     flex    randspooklines=0.0                    local
  80.     flex    randtraplines=0.0                    local
  81.     flex    randzippolines=0.0                    local
  82. end
  83.  
  84. # ==============================================================================
  85.  
  86. code
  87.  
  88. # ..............................................................................
  89.  
  90. user0:
  91.  
  92.     # NOTE: Indy worries about SPOOKY PLACES...
  93.     #
  94.     # Proper command to reach this response section from the calling cog is:
  95.     #
  96.     # SendMessageEx(negtalkcogREF, user0, f_talkerREF, f_forceTalk, f_forceLine, 0);
  97.     #
  98.     # global15 is used here like so:
  99.     #
  100.     # global15 == 0 while this cog is at work (waiting for line to finish)
  101.     # global15 == 1 upon return
  102.     #
  103.     # As discussed in user0 section, the calling cog can use global15 as a semaphore
  104.     #
  105.     # Hey!  You can also force a line choice.  Here's how:
  106.     # 1. Note your intention by setting f_forceTalk parm to some non-zero value
  107.     # 2. Examine the available lines to find the one you want (counting from 0)
  108.     # 3. Pass that number in the forceLine parameter (parm2)
  109.  
  110.     if (alreadyworking > 0)
  111.     {
  112.         return;
  113.     }
  114.  
  115.     alreadyworking = 1; # stall multiple calls
  116.  
  117.     global15 = 0; # init each call
  118.  
  119.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  120.     forceTalk = GetParam(1); # force a choice
  121.     forceLine = GetParam(2); # actual line choice
  122.     
  123.     if (forceTalk > 0)
  124.     {
  125.         s_newline = forceLine; # choose this line
  126.         s_oldline = 0;
  127.     }
  128.  
  129.     call randspooklines;
  130.     global15 = 1;
  131.     alreadyworking = 0;
  132.  
  133.     return;
  134.  
  135. # ........................................................................................
  136.  
  137. user1:
  138.  
  139.     # NOTE: Indy thinks a TRAP is nearby...
  140.     #
  141.     # Proper command to reach this response section from the calling cog is:
  142.     #
  143.     # SendMessageEx(negtalkcogREF, user1, f_talkerREF, f_forceTalk, f_forceLine, 0);
  144.     #
  145.     # global15 is used here like so:
  146.     #
  147.     # global15 == 0 while this cog is at work (waiting for line to finish)
  148.     # global15 == 1 upon return
  149.     #
  150.     # As discussed in user0 section, you can force a line choice.
  151.  
  152.     if (alreadyworking > 0)
  153.     {
  154.         return;
  155.     }
  156.  
  157.     alreadyworking = 1; # stall multiple calls
  158.  
  159.     global15 = 0; # init each call
  160.  
  161.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  162.     forceTalk = GetParam(1); # force a choice
  163.     forceLine = GetParam(2); # actual line choice
  164.     
  165.     if (forceTalk > 0)
  166.     {
  167.         t_newline = forceLine; # choose this line
  168.         t_oldline = 0;
  169.     }
  170.  
  171.     call randtraplines;
  172.     global15 = 1;
  173.     alreadyworking = 0;
  174.  
  175.     return;
  176.  
  177. # ........................................................................................
  178.  
  179. user2:
  180.  
  181.     # NOTE: Indy wishes he had some LIGHT (zippo clue)...
  182.     #
  183.     # Proper command to reach this response section from the calling cog is:
  184.     #
  185.     # SendMessageEx(negtalkcogREF, user2, f_talkerREF, f_forceTalk, f_forceLine, 0);
  186.     #
  187.     # global15 is used here like so:
  188.     #
  189.     # global15 == 0 while this cog is at work (waiting for line to finish)
  190.     # global15 == 1 upon return
  191.     #
  192.     # As discussed in user0 section, you can force a line choice.
  193.  
  194.     if (alreadyworking > 0)
  195.     {
  196.         return;
  197.     }
  198.  
  199.     alreadyworking = 1; # stall multiple calls
  200.  
  201.     global15 = 0; # init each call
  202.  
  203.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  204.     forceTalk = GetParam(1); # force a choice
  205.     forceLine = GetParam(2); # actual line choice
  206.     
  207.     if (forceTalk > 0)
  208.     {
  209.         z_newline = forceLine; # choose this line
  210.         z_oldline = 0;
  211.     }
  212.  
  213.     call randzippolines;
  214.     global15 = 1;
  215.     alreadyworking = 0;
  216.  
  217.     return;
  218.  
  219. # ..............................................................................
  220.  
  221. randspooklines:
  222.  
  223.     while (s_newline == s_oldline)
  224.     {        
  225.         s_newline = RandBetween(0, 11);
  226.         if (s_newline > 9)
  227.         {
  228.             s_newline = 3; # 1/6 chance for line 3
  229.         }
  230.         else
  231.         {    
  232.             s_newline = RandBetween(0, 2); # 1/4 chance for lines 0 thru 2
  233.         }
  234.     }
  235.     s_oldline = s_newline;    
  236.     lineindex = spookoffset + s_newline;
  237.  
  238.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  239.  
  240.     return;
  241.  
  242. # ..............................................................................
  243.  
  244. randtraplines:
  245.  
  246.     while (t_newline == t_oldline)
  247.     {        
  248.         t_newline = RandBetween(0, 5);
  249.         if (t_newline > 3)
  250.         {
  251.             t_newline = 3; # 2/6 chance for 3
  252.         }
  253.         else
  254.         {
  255.             t_newline = RandBetween(0, 2); # 1/6 chance for 0 thru 2
  256.         }
  257.     }
  258.     t_oldline = t_newline;
  259.     lineindex = trapoffset + t_newline; # 1/4 chance
  260.  
  261.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  262.  
  263.     return;
  264.  
  265. # ..............................................................................
  266.  
  267. randzippolines:
  268.  
  269.     while (z_newline == z_oldline)
  270.     {        
  271.         z_newline = RandBetween(0, 2);
  272.     }
  273.     z_oldline = z_newline;
  274.     lineindex = zipoffset + z_newline; # 1/3 chance
  275.  
  276.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  277.  
  278.     return;
  279.  
  280. end
  281.  
  282.